<ion-view view-title=任务列表 >
  <ion-content>
    <ion-refresher on-refresh="doRefresh()"
                   pulling-text="下拉刷新..."
                   refreshing-text="拼命加载中..."
                   refreshing-icon="ion-loading-b">

    </ion-refresher>
      <div class="list card" ng-repeat="mymission in mymissions" href="#">
        <div ng-if="mymission.orderInfo.get('type') != 11 && mymission.orderInfo.get('type')!=12">
          <div class="item">
            <h2>{{mymission.area.areaName}}区-

              <span ng-if="(mymission.orderInfo.get('type') != 9)" style="color: red;">{{mymission.orderInfo.get('type') | orderTypeName}}</span>
              <span ng-if="(mymission.orderInfo.get('type') === 9)">商家外卖</span>
            <span ng-bind-html="mymission.orderid | colorString">
            </span>
              <a class="float-right" style=" color: orange" ng-click="goToFirst(mymission.orderid)">优先</a>
              <!--<span style="color: orange;">{{mymission.orderInfo.get('status') |  orderState }}</span>-->
            </h2>
          </div>
          <div class="item item-body">
            <p>
              <i class="icon ion-ios-home" style="font-size: x-large;color: orange;"></i>
              {{mymission.address.address}}
            </p>
            <!--<p>-->
            <!--收件人：{{mymission.address.name}} <a>{{mymission.address.phone}}</a>-->
            <!--</p>-->
            <!--<p ng-if="(mymission.orderInfo.get('type') != 9)">
              取件地址：{{mymission.shop.areaName}}
            </p>
            <p ng-if="(mymission.orderInfo.get('type') === 9)">
              取件地址：{{mymission.orderInfo.get('sellerName')}}&#45;&#45;{{mymission.orderInfo.get('storeName')}}
            </p>-->
            <p>
              <i class="icon ion-ios-people" style="font-size: x-large;color: orange;"></i>
              {{mymission.address.name}}
              <a href="tel:{{mymission.address.phone}}">{{mymission.address.phone}}</a>
              <a href="tel:{{mymission.address.phone}}" class="icon ion-ios-telephone"></a>
            </p>
            <!--<p>
            下单时间：{{mymission.orderInfo.createdAt | date : 'yyyy-MM-dd HH:mm:ss'}}
            </p>-->
            <p >
              <i class="icon ion-arrow-graph-up-right" style="font-size: x-large;color: orange;"></i>
              {{mymission.orderInfo.get('status') |  orderState }}
            </p>
            <p ng-if="mymission.bookdate !=undefined">
              预约时间：{{mymission.bookdate | date : 'yyyy-MM-dd HH:mm:ss'}}
            </p>
          </div>
          <!--<div class="item button-bar" >-->
            <!--<a class="button" style="color:white;background-color: red" ng-show="mymission.orderStatus<0" ng-click="cancelMission(mymission.orderid)">取消</a>-->
            <!--<a class="button" ng-click="gotoDetail(mymission.orderid)">任务详情</a>-->
          <!--</div>-->
          <div class="row ">
            <!-- mymission.orderInfo.get('status') === 7000-->
            <div class="col" ng-show="false">
              <button class="button button-balanced button-small button-block" ng-click="dispatching(event,mymission.orderid,mymission)">
                <i class="icon ion-ios-stopwatch-outline "></i>
                <b >开始派送</b>
              </button>
            </div>
            <div class="col" ng-show="mymission.orderInfo.get('status') === 8000 || mymission.orderInfo.get('status') === 7000">
              <button class="button button-assertive button-small button-block" ng-click="successfully(event,mymission.orderid,mymission)">
                <i class="icon ion-android-walk "></i>
                <b>完成派送</b>
              </button>
            </div>
            <div class="col">
              <button class="button button-calm button-small button-block" ng-click="gotoDetail(mymission.orderid)">
                <i class="icon ion-ios-book-outline "></i>
                <b>任务详情</b>
              </button>
            </div>
          </div>
        </div>
        <div ng-if="mymission.orderInfo.get('type') === 11 || mymission.orderInfo.get('type')===12">
          <div class="item">
            <h2>{{mymission.orderInfo.get('orderid')}}<a class="float-right" style="font-size: large; color: red">{{mymission.orderInfo.get('type')|orderTpe}}</a></h2>
          </div>
          <div class="item item-body">
            <p ng-if="mymission.orderInfo.get('type')==12">
              取件地址：{{mymission.orderInfo.get('shopId')|shop}}
            </p>
            <p ng-if="mymission.orderInfo.get('type')==11">
              退件地址：{{mymission.orderInfo.get('shopId')|shop}}
            </p>
            <p>
              客户地址：{{mymission.orderInfo.get('address').address}}
            </p>
            <p>
              客户信息：{{mymission.orderInfo.get('address').name}} <a>{{mymission.orderInfo.get('address').phone}}</a>
            </p>
            <p>
              商品明细：
            <div ng-repeat="goods in mymission.orderInfo.get('goods')">
              {{goods.pname}} {{goods.sname}} {{goods.size}}*{{goods.price}}元
            </div>
            </p>
            <p>
              备注：{{mymission.orderInfo.get('remark')}}
            </p>
            <p>
              原订单支付方式：{{mymission.orderInfo.get('payway')}}
            </p>
            <p ng-if="mymission.orderInfo.get('type')==11" style="font-size: large; color: red">
              退款明细：退给用户现金 ({{mymission.orderInfo.get('finalAmount')}}元)
            </p>
            <p>
              订单状态：{{mymission.orderInfo.get('status') |  orderState }}
            </p>
          </div>
        </div>
      </div>

    <div ng-if="(mymissions.length == 0)" class="card">
      <div class="item item-text-wrap">
        啥都没有~去领任务吧。
      </div>
    </div>
    <div style="text-align: center" ng-if="(mymissions.length != 0)">
      <a style="color: green;text-align: center" ng-click="getMore()" >{{loadmore.more}}</a>
    </div>
  </ion-content>
</ion-view>
